<?php 
/**
 * eBay Label Printing Program Sellers Database Table Class 
 * this is a Db Table Class , It stores customer login informations
 * @package  eBayLabelPrinter
 * @category Models/DbTable
 * @author   Norman Dong <norman.dong@hotmail.com>
 * @version  Initial
 * @copyright LeadCasket.com
 * @link     www.leadcasket.com
 * @license  Commercial
 */
 class Model_DbTable_Sellers_Seller extends Zend_Db_Table_Abstract 
{
	/**
	 * @var string Class Table Name
	 */
	protected $_name = 'seller'; 
	/**
	 * Get Seller information by ID 
	 * Fetch array by Seller ID, Make sure do not fetch the password and unique ID
	 * @param int $idSeller  The Seller ID
	 * @return array  Not decide what to return 
	 */ 
 	public function getSeller($sellerID){
 		
 		$row = $this->fetchRow('`id_seller`='.(int)$sellerID);
 		if(!$row){
 			return false;
 		}
 		return $row->toArray();		
		}
	/**
	 * Get Seller information by ID 
	 * Fetch array by Seller ID, Make sure do not fetch the password and unique ID
	 * @param int $idSeller  The Seller ID
	 * @return array  Not decide what to return 
	 */ 
 	public function getSellerId($userNameSeller){
		$select = $this->_db->select()
  					    ->from ($this->_name,array('username_seller'))
					    ->where(' username_seller =?',$userNameSeller);
    	$result = $this ->getAdapter()->fetchOne($select);
    
		if($result){
   				return $result;
   				}					  	
  		return false;		
		}		
	/**
	 * Add a New Seller Function
	 * Fetch array by profile ID ,Maybe only useable when need update
	 * @param int $idLabelProfile  The Label Profile ID
	 * @return array The Label Profile Array
	 */		
	public function addSeller($userNameSeller,$userEmailSeller,$uniqueIdSeller,$passWordSeller,$unzipPassword,$passwordHint,$groupSeller){
		$data = array(           
            'username_seller' => $userNameSeller,
			'user_email_seller' => $userEmailSeller,
			'unique_id_seller' => $uniqueIdSeller,
			'password_seller' => $passWordSeller,
			'unzippassword_seller' => $unzipPassword,
			'password_hint' => $passHint,
			'group_seller' => $groupSeller,
        );
        try{
			$this->insert($data);
		}
		catch(Exception $e){
			return false;
			}
		return true;
		}
		
	/**
	 * Active Newly created Seller
	 * Fetch array by profile ID ,Maybe only useable when need update
	 * @param int $idLabelProfile  The Label Profile ID
	 * @return array The Label Profile Array
	 */		
	public function activeSeller($sellerID){
		
		}
	/**
	 * Disable certain Seller
	 * Fetch array by profile ID ,Maybe only useable when need update
	 * @param int $idLabelProfile  The Label Profile ID
	 * @return array The Label Profile Array
	 */		
	public function disableSeller($sellerID){
		
		}
	/**
	 * Update Seller information
	 * Fetch array by profile ID ,Maybe only useable when need update
	 * @param int $idLabelProfile  The Label Profile ID
	 * @return array The Label Profile Array
	 */		
	public function updateSeller(){
		
		}
	/**
	 * Check if the Seller User Name has been Used
	 * Fetch array by profile ID ,Maybe only useable when need update
	 * @param int $idLabelProfile  The Label Profile ID
	 * @return array The Label Profile Array
	 * @todo Give recommendation for changing the user name 
	 */		
	public function checkUniqueSellerName($userNameSeller){
		
		$select = $this->_db->select()
  					    ->from ($this->_name,array('username_seller'))
					    ->where(' username_seller =?',$userNameSeller);
    	$result = $this ->getAdapter()->fetchOne($select);
    
		if($result){
   				return true;
   				}					  	
  		return false;
		}
	/**
	 * Check if the Seller had registered already
	 * Fetch array by profile ID ,Maybe only useable when need update
	 * @param int $idLabelProfile  The Label Profile ID
	 * @return array The Label Profile Array
	 */			
	public function checkUniqueSeller($userNameSeller,$userEmailSeller){
		
		$select = $this->_db->select()
  					    ->from ($this->_name,array('username_seller'))
					    ->where(' username_seller =?',$userNameSeller)
						->where(' user_email_seller =?',$userEmailSeller);
    	$result = $this ->getAdapter()->fetchOne($select);
    
		if($result){
   				return true;
   				}					  	
  		return false;
			
		}	
	/**
	 * Genrate Security password according Unique id and the customer Provided password
	 * Fetch array by profile ID ,Maybe only useable when need update
	 * @param int $idLabelProfile  The Label Profile ID
	 * @return array The Label Profile Array
	 */		
	private function generatePassword(){
		
		}
	/**
	 * Check the Security password Match Or Not
	 * Fetch array by profile ID ,Maybe only useable when need update
	 * @param int $idLabelProfile  The Label Profile ID
	 * @return array The Label Profile Array
	 */		
	private function checkPassword(){
		
		}
										
}
 ?>